﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;

namespace ZG_member
{
    public partial class SalesCustomers : Form
    {
        public SalesCustomers(string saId)
        {
            InitializeComponent();
            skinEngine1.SkinFile = Application.StartupPath + ConfigurationManager.AppSettings["Skin"];
            this.Opacity = 0;
            salesId = saId;
        }
        string salesId = "";
        private void SalesCustomers_Load(object sender, EventArgs e)
        {
            this.timer1.Start();
            this.label2.Text = salesId;
            ZG_member.BLL.memberInfo member = new ZG_member.BLL.memberInfo();
            ZG_member.Model.memberInfo memberMode = new ZG_member.Model.memberInfo();
            dgvMemberInfo.DataSource= member.GetList(" OpenTeacher='"+salesId+"'").Tables[0];
            ZG_member.BLL.consumeSolution consume = new ZG_member.BLL.consumeSolution();
                Model.consumeSolution consumeMod = new Model.consumeSolution();
                ZG_member.BLL.Areas area = new ZG_member.BLL.Areas();
                ZG_member.Model.Areas areMode = new ZG_member.Model.Areas();
                ZG_member.BLL.taocanjiluBLL taocan = new ZG_member.BLL.taocanjiluBLL();
                Model.taocanjilu taocanMode = new Model.taocanjilu();
                string[] list = new string[] { };

                foreach (DataGridViewRow dgvr in dgvMemberInfo.Rows)
                {
                    string cardType1 = dgvr.Cells["cardType1"].Value.ToString();
                    if (cardType1 != "")
                    {
                        int ID = int.Parse(dgvr.Cells["cardType1"].Value.ToString());
                        consumeMod = consume.GetModelList("id='" + ID + "'")[0];
                        dgvr.Cells["NewcardType"].Value = consumeMod.solutionName;
                    }
                    if (dgvr.Cells["AreasID"].Value != "")
                    {
                        int id = int.Parse(dgvr.Cells["AreasID"].Value.ToString());
                        areMode = area.getModel(id);
                        dgvr.Cells["AreaName"].Value = areMode.AreaName;
                    }
                }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Left += 2;
            this.Opacity += 0.1;
            if (Opacity == 1)
            {
                this.timer1.Stop();

            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            this.Top = this.Top + 10;
            this.Opacity = this.Opacity - 0.06;
            if (Opacity <= 0)
            {
                this.timer2.Stop();
                this.Close();
            }
        }
        int flag = 0;
        private void SalesCustomers_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (flag == 0)
            {
                e.Cancel = true;
                flag = 1;
                this.timer2.Start();
            }
        }
    }
}
